package state;

/**
 * 状态实现类
 * 保证状态唯一性，所有状态均为单例
 */
public class StateA implements State{

    //单例初始化
    private static final StateA instance = new StateA();

    @Override
    public void updateState(Context context) {
        System.out.println("当前状态A");
        context.setCurrentState(StateB.instance());
        System.out.println("更新为状态B");
    }

    public static StateA instance(){
        return instance;
    }
}
